import cv2
import pylab
import numpy as np


#对lena进行逆时针45度的翻转，并进行0.6倍缩放
lena=cv2.imread("train_image/dollor.png")
lena=cv2.cvtColor(lena,cv2.COLOR_BGR2RGB)
rows,cols,ch=lena.shape
p1=np.float32([[0,0],[cols-1,0],[0,rows-1]])
p2=np.float32([[0,rows*0.33],[cols*0.85,rows*0.25],[cols*0.15,rows*0.7]])
M=cv2.getAffineTransform(p1,p2)
dst=cv2.warpAffine(lena,M,(cols,rows))
pylab.imshow(dst)
pylab.show()